package com.rain.rainspringboot3.order.controller;

import com.rain.rainspringboot3.order.entity.Order;
import com.rain.rainspringboot3.order.strategy.impl.OrderSaveContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private OrderSaveContext orderSaveContext;

    @PostMapping("/order")
    public String createOrder(@RequestBody Order order) {
        orderSaveContext.save(order);
        return "订单创建成功";
    }
}